﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swcommands;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.swpublished;

using SwAddinHelpers.Contracts;
using SwAddinHelpers.Base;
using SwAddinHelpers.Attributes;
using SwAddinHelpers.Sinks;

using System.Runtime.InteropServices;
using System.Reflection;
using Microsoft.Win32;


namespace ExternalControls
{
    [ComVisible(true)]
    [ProgId(PROGID)]
    public sealed partial class PropertyManagerControl1 : ActiveXUserControlBase
    {
        public const string PROGID = "SwExternalControls.ExternalPropertyManagerControl1";
        public const short HEIGHT = 420;
        public const short WIDTH = 150;
        public const int CONTROLID = 20000;

        public PropertyManagerControl1()
        {
            InitializeComponent();

            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            propertyGrid1.SelectedObject = _OwnerHost.OwnerAddin.SolidWorksApplication.GetType();
        }

        [SinkMethod(enumEventSink.SW_ActiveDocChangeNotify)]
        private void ActiveDocChangedNotification(object sender, EventArgs e)
        {
            MessageBox.Show("From PropertyManagerControl1: ActiveDocChangeNotify fired");   
        }

        [InvokableMethod("TestMethod1")]
        private void TestMethodNoParams()
        {
            MessageBox.Show("From PropertyManagerControl1: TestMethod1 Invoked");
        }

        [InvokableMethod("TestMethod2")]
        private void TestMethodWithParams(int i, string j)
        {
            MessageBox.Show("From PropertyManagerControl1: TestMethod2 Invoked " + i.ToString() + " : " + j);
        }

        [InvokableMethod("TestMethod3")]
        private void Taaa()
        {
            MessageBox.Show("From PropertyManagerControl1: TestMethod3 Invoked");
        }

     
    }
}
